
import multiprocessing as mp
import threading as td

def job(q):
    res = 0
    for i in range(10000):
        res += i + i**2 + i**3
    q.put(res)

if __name__ == '__main__':
    # 多线程创建，和多进程类似
    # t1 = td.Thread(target=job,args=(1,2))
    # t1.start()
    # t1.join()

    # 多进程计算
    q = mp.Queue()
    p1 = mp.Process(target=job,args=(q,))
    p2 = mp.Process(target=job,args=(q,))
    p1.start()
    p2.start()
    p1.join()
    p2.join()
    res1 = q.get()
    res2 = q.get()
    print(res1+res2)

    import collections
    ds = collections.Counter("asdasddd")
    print(ds)
    print(ds["d"])
    print(enumerate("kjhkjhk"))
    for k,v in enumerate("kjskdfj"):
        print(k,v)

    ds2=collections.Counter(["a","b","c","a","b"])
    print(ds2)



